//
//  NewInformationBottomView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/19.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "NewInformationBottomView.h"

@implementation NewInformationBottomView

- (id)initWithInSuperView:(UIView *)aSuperView
{
    if (self = [super initWithInSuperView:aSuperView]) {
        NSInteger height = kHeightProportion_In_iPhoneTriploid(50);
        if (iPhoneX) {
            height += kHeightProportion_In_iPhoneTriploid(34);
        }
        [self mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(aSuperView.mas_left);
            make.bottom.equalTo(aSuperView.mas_bottom);
            make.width.equalTo(aSuperView.mas_width);
            make.height.equalTo(@(height));
        }];
        self.backgroundColor = [UIColor whiteColor];
        
        GLGWView *baV = [[GLGWView alloc] initWithInSuperView:self];
        [baV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.right.equalTo(self.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(40)));
            make.top.equalTo(self).offset(kHeightProportion_In_iPhoneTriploid(8));
        }];
        baV.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        baV.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(20);
    
        GLGWImageView *leftImgV = [[GLGWImageView alloc] initWithImageName:@"icon_zhuanxie" inSuperView:baV];
        [leftImgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(baV.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(20)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(19)));
            make.centerY.equalTo(baV.mas_centerY);
        }];
        
        GLGWImageView *rightImgV = [[GLGWImageView alloc] initWithImageName:@"icon_xiaolian" inSuperView:baV];
        [rightImgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(baV.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.width.height.equalTo(@(kWidthProportion_In_iPhoneTriploid(20)));
            make.centerY.equalTo(baV.mas_centerY);
        }];
        
        GLGWButton *desBtn = [[GLGWButton alloc] initWithTitle:@"我也来说两句" titleLableFont:SYSTEMFONT(14) titleLableColor:[UIColor colorWithHexString:@"#333333"] inSuperView:baV];
        [desBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(leftImgV.mas_right).offset(kWidthProportion_In_iPhoneTriploid(10));
            make.right.mas_lessThanOrEqualTo(rightImgV.mas_left);
            make.centerY.equalTo(rightImgV.mas_centerY);
            make.height.equalTo(baV.mas_height);
        }];
        [desBtn addTarget:self action:@selector(desAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

- (void)desAction:(GLGWButton *)sender
{
    if (self.BlockReply) {
        self.BlockReply(sender);
    }
}


@end
